/* Marat
boss spawn npc
*/
var status = -1;
var x = 0
var items = Array(2049100, 1012070, 2340000, 1132004, 2040807);
var price = Array(1, 4, 7, 7, 10);

function action(mode, type, selection) {
    if (mode == 1) {
	status++;
    } else {
	if (status == 2) {
	    cm.sendNext("test");
	}
	status--;
    }
	if (status == 0) {
    var talk = ("Hello i am the SteadyMaple Vote Point shop. \r\nI will exchange vote points that you get from voting for cool items!\r\n Please select a item:\r\n You have "+ cm.getVPoints() +" Voting Points");
	for(var m=0; m < items.length; m++){
	talk += "\r\n#L"+ m +"##i"+ items[m] +"##t"+ items[m] +"# For "+ price[m] +" Voting Points.";
	}
	cm.sendSimple(talk);

	
    } else if (status == 1) {
	if(cm.getVPoints() >= price[selection]){
	cm.gainVPoints(-price[selection]);
	cm.gainItem(items[selection], 1);
	cm.sendNext("Enjoy your items!");
	cm.dispose();
	} else {
	cm.sendNext("Not enough voting points!");
	cm.dispose();
	}


	
}
}

